<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			* { 
				box-sizing: border-box;
				margin: 0px;
				padding: 0px;
			}
			
			.LoginMain {
				border: 1px solid;
				height: 100%;
				min-width: 320px;
				max-width: 640px;
			}
			
			input {
				width: 100%;
				border: none;
				height: 50px;
			}
			
			input::-webkit-input-placeholder {
				text-align: center;
				font-size: 18px;
				line-height: 18px;
			}
			
			input::-moz-input-placeholder {
				text-align: center;
			}
			
			input:not([type=submit]) {
				border: 1px solid;
			}
		</style>
		<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/md5.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jmessage-sdk-web-2.1.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div class="LoginMain">
			<p><input type="text" name="username" id="username" value="" placeholder="邮箱/用户名" /></p>
			<p><input type="password" name="password" id="password" value="" placeholder="密码" /></p>
			<p><input type="button" name="login" id="login" value="登陆" onclick="mylogin()" /></p>
			<p>
				<a href="#">忘记密码</a>
				<a href="register.html">新用户注册</a>
			</p>
		</div>
		<script type="text/javascript">
			function mylogin() {
				JIM.login({
					'username': $("#username").val(),
					'password': $("#password").val()
				}).onSuccess(function(data) {
					location.href = "index.html"+"?username="+$("#username").val()+"&password="+escape($("#password").val());
					console.log('success:' + JSON.stringify(data));
					JIM.onMsgReceive(function(data) {
						data = JSON.stringify(data);
						console.log('msg_receive:' + data);
						appendToDashboard('msg_receive:' + data);
					});

					JIM.onEventNotification(function(data) {
						console.log('event_receive: ' + JSON.stringify(data));
					});
				}).onFail(function(data) {
					console.log('error:' + JSON.stringify(data));
				}).onTimeout(function(data) {
					console.log('timeout:' + JSON.stringify(data));
				});
			}
		</script>
	</body>

</html>